﻿/*
 * Copyright (C) 2012, Jesus Requejo <jesus.requejo@gmail.com> 
 * Licensed under Microsoft Public License (Ms-PL)
 * http://www.microsoft.com/en-us/openness/licenses.aspx#MPL
*/

namespace Infrastructure {

   using System;
   using System.Linq.Expressions;
   
   public static class StronglyTypedProperty<T> {
      public static string Map<P>(Expression<Func<T, P>> action) {

         var expressionBody = action.Body as MemberExpression;

         if (expressionBody == null) {
            throw new ArgumentException("The body of the lambda function is not a member expression");
         }

         string name = expressionBody.Member.Name;
         return name;
      }
   }
}

